﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace WiMo.Games
{
    public class GameTime
    {

        public TimeSpan ElapsedGameTime { get; private set; }
        public TimeSpan TotalGameTime { get; private set; }
        private DateTime _start;
        private DateTime _startUpdate;

        public GameTime(TimeSpan elapsedGameTime, TimeSpan totalGameTime)
        {
            ElapsedGameTime = elapsedGameTime;
            TotalGameTime = totalGameTime;
        }

        public GameTime()
        {
            ElapsedGameTime = TotalGameTime = TimeSpan.Zero;
            _start = DateTime.Now;
            _startUpdate = DateTime.Now;            
        }

        private GameTime(DateTime start, DateTime startUpdate)
        {
            _start = start;
            _startUpdate = startUpdate;
        }

        public GameTime Clone()
        {
            return new GameTime(_start, _startUpdate);
        }

        public void Update(double ms)
        {
            ElapsedGameTime = TimeSpan.FromMilliseconds(ms);
            TotalGameTime += ElapsedGameTime;
        }

    }
}
